import config from '@/config';
import RequestBase from '@/utils/request.js';

const baseRequest = new RequestBase(config.equipment);

// 获取润滑任务列表
export function queryLubricationTask(data) {
  return baseRequest.get('/dfm/lubrication/task/list/execute', data);
}

// 获取润滑任务详情
export function queryLubricationTaskDetail(id) {
  return baseRequest.get(`/dfm/lubrication/task/${id}?enableUser=true`)
}

// 获取任务润滑记录
export function queryTaskLubricationRecord(taskId, itemId) {
  return baseRequest.get(`/dfm/lubrication/task/${taskId}/record/${itemId}`)
}

// 执行润滑任务
export function executeLubricationTask(data) {
  return baseRequest.post(`/dfm/lubrication/task/subItemTask/${data.taskSubItemId}/execute`, data)
}

// 确认润滑任务
export function confirmLubricationTask(taskId, data) {
  return baseRequest.post(`/dfm/lubrication/task/${taskId}/confirm`, data)
}

// 根据任务获取润滑信息
export function queryTaskItemDetail(taskId, taskSubItemId, enableUser) {
  return baseRequest.get(`/dfm/lubrication/task/${taskId}/itemDetail/${taskSubItemId}?enableUser=${enableUser}`)
}

//获取润滑标准
export function getLubricationStandard(params) {
  return baseRequest.get(`/dfm/lubrication/device/${params}`)
}

//获取润滑记录
export function getLubricationRecord(params) {
  return baseRequest.get(`/dfm/lubrication/getDeviceRecordList`, params)
}
